<?php
  /***************************************************************
   * @file: main.php
   * @author: Neo
   * @mail: xq262144@gmail.com
   * @date: 
   * @description:
   * this file is the main access of the upload technic to this 
   * framework
   ***************************************************************/
 
  if (!defined('SYS_BASEPATH')) {echo "No script access allowed!"; header("HTTP/1.0 404 Not Found"); }
  
  require_once(SYS_LIB . '/upload/FileUpload.class.php');
  require_once(SYS_CONFIG . '/upload.php');
  
  function upload_file($filetype, $field) {
	if (!is_array($filetype))
		return null;
	if (!is_string($field))
		return null;
    $file = new FileUpload($field, $filetype, SYS_UPLOAD);
    if (!$file->checkUploadErr()) {
      report_error($file->getErrMsg());
      return false;
    }
	return $file;
  }
?>